package com.scvtc.controller.research;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.dto.research.book.ResearchCourseBookDto;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.domain.vo.research.book.ResearchCourseBookVo;
import com.scvtc.service.research.ResearchCourseBookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 科研教材信息(ResearchCourseBook)表控制层
 *
 * @author yiFei
 * @since 2022-06-02 16:17:07
 */
@Api(tags = "科研教材信息(ResearchCourseBook)")
@RestController
@RequestMapping("researchCourseBook")
public class ResearchCourseBookController {
    /**
     * 科研教材信息(ResearchCourseBook)对象
     */
    @Autowired
    private ResearchCourseBookService researchCourseBookService;

    @GetMapping("/list")
    @ApiOperation("查询科研教材信息")
    public ResResult<PageVo<List<ResearchCourseBookVo>>> getAllResearchCourseBook(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            ResearchCourseBookVo researchCourseBookVo) {
        return researchCourseBookService.getAllResearchCourseBook(current, size, researchCourseBookVo);
    }

    @PostMapping("/")
    @ApiOperation("添加单个科研教材")
    public ResResult<?> addResearchCourseBook(@RequestBody ResearchCourseBookDto researchCourseBookDto) {
        return researchCourseBookService.addResearchCourseBook(researchCourseBookDto);
    }

    @PutMapping("/")
    @ApiOperation("修改单个科研教材")
    public ResResult<?> updateStudent(@RequestBody ResearchCourseBookDto researchCourseBookDto) {
        return researchCourseBookService.updateResearchCourseBook(researchCourseBookDto);
    }

    @DeleteMapping("/")
    @ApiOperation("删除一条科研教材信息")
    public ResResult<?> deleteResearchCourseBook(Long id) {
        return researchCourseBookService.deleteResearchCourseBook(id);
    }

    @DeleteMapping("/multiple")
    @ApiOperation("删除多条科研教材信息")
    public ResResult<?> deleteMultipleResearchCourseBook(Long[] ids) {
        return researchCourseBookService.deleteMultipleResearchCourseBook(ids);
    }


}

